//
//  UIBarbuttonItem-Extention.swift
//  斗鱼直播Swift
//
//  Created by admin on 2018/2/23.
//  Copyright © 2018年 admin. All rights reserved.
//

import UIKit
extension UIBarButtonItem {
    class func createItem(imageName:String,hightImageName:String,size:CGSize) -> UIBarButtonItem {
        let button = UIButton.init()
        button.setImage(UIImage.init(named: imageName), for: .normal)
        button.setImage(UIImage.init(named: hightImageName), for: .highlighted)
        button.frame = CGRect.init(origin: CGPoint.zero, size: size)
        return UIBarButtonItem.init(customView: button)
    }
    
    convenience  init(imageName:String,hightImageName:String,size:CGSize) {
        
        let button = UIButton.init()
        button.setImage(UIImage.init(named: imageName), for: .normal)
        button.setImage(UIImage.init(named: hightImageName), for: .highlighted)
        button.frame = CGRect.init(origin: CGPoint.zero, size: size)
        self.init(customView: button)
        
    }
}
